var resObject;
var mode; //0:ActiveX1 (IE7) / 1:ActiveX2 / 2:XMLHttpRequest (Firefox)

image1 = new Image();
image1.src = "./images/colorchooser_bg1.png";
image1b = new Image();
image1b.src = "./images/colorchooser_bg1b.png";
image2 = new Image();
image2.src = "./images/colorchooser_bg2.png";
image2b = new Image();
image2b.src = "./images/colorchooser_bg2b.png";

function init()
{
	try
	{
		resObject = new ActiveXObject("Microsoft.XMLHTTP");
		mode = 0;
	}
	catch(Error)
	{
		try
		{
			resObject = new ActiveXObject("MSXML2.XMLHTTP");
			mode = 1;
		}
		catch(Error)
		{
			try
			{
				resObject = new XMLHttpRequest();
				mode = 2;
			}
			catch(Error)
			{
				alert("Could not initialise the XMLHttpRequest-Object.");
			}
		}
	}
}

function mouseIn(id1, id2)
{
	this.document.getElementById(id1).style.backgroundImage = "url("+image1b.src+")";
	this.document.getElementById(id2).style.backgroundImage = "url("+image2b.src+")";
}

function mouseOut(id1, id2)
{
	this.document.getElementById(id1).style.backgroundImage = "url("+image1.src+")";
	this.document.getElementById(id2).style.backgroundImage = "url("+image2.src+")";
}

function openNewColor()
{

	newColorWindow = window.open( "./newcolor.php" , "newColorWindow" , "width=300, height=550, scrollbar=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no");
}

function deleteColors()
{
	requestDeleteColors();
}

function requestDeleteColors()
{
	resObject.open('get', './deletecolors.php', true)
	resObject.onreadystatechange = responseDeleteColors;
	resObject.send(null);
}

function responseDeleteColors()
{
	window.location.reload(true);
}

function changeColor(red, green, blue)
{
	opener.setBackgroundColor(red, green, blue);
	close();
}



